import java.util.ArrayList;
import  java.util.List;
import java.util.Random;


abstract  class Shape{
    abstract public void calculateArea();
}
class Circle extends Shape {
    private int radius;
    public static final double PI = 3.1415926;
    public Circle(int radius){
        this.radius = radius;
    }

    public void calculateArea(){
        double area;
        area = PI*radius*radius;
        System.out.println("当半径为"+radius+"时,Circle area:"+area);
    }
}
class Rectangle extends Shape {
    private int length;
    private  int height;
    public Rectangle (int length,int height){
        this.length = length;
        this.height = height;
    }
    public void calculateArea(){
        double area;
        area = length*height;
        System.out.println("当长为"+length+",高为"+height+"时,Rectangle area:"+area);
    }
}

public class ShapeClass {
    public static void main(String[] args) {
        List<Shape>shapes = new ArrayList<>();
        Random random = new Random();
        for(int i =1 ;i<=10;i++){
            int shapeType = random.nextInt(2);
            switch(shapeType){
                case 0:
                    shapes.add(new Circle(i));
                    break;
                case 1:
                    shapes.add(new Rectangle(i,i+1));
                    break;
            }
        }
        for(Shape shape:shapes){
            shape.calculateArea();
        }
    }
}
